<template>
	<view class="setting">
		<view class="set-but">
			<button class="but" plain @click="toClick(1)">关于我们
				<uni-icons type="right" color="#000000" size="30r" />
			</button>
			<button class="but" plain @click="toClick(3)">隐私协议
				<uni-icons type="right" color="#000000" size="30r" />
			</button>
			<button class="but" plain @click="toClick(2)">软件使用许可协议
				<uni-icons type="right" color="#000000" size="30r" />
			</button>
		</view>
		<view class="bom-but">
			<button class="but" plain @click="tuichu">退出登录</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: '/hotelAdmin/my/setting/protocol-rules/protocol-rules', // 公告的规则协议页面
			}
		},
		methods: {
			/**
			 * 关于我们
			 * @param {string} pid  判断跳转的途径 1：关于我们 2：软件使用许可协议 3：隐私协议
			 */
			toClick(pid) {
				uni.navigateTo({
					url: `${this.url}?pid=${pid}`
				});
			},
			/**
			 * 退出按钮
			 */
			async tuichu() {
				
				try {
					// 清空后台数据 测试用
					// let rep = await this.$http.post('/index/index/deldata')
					// console.log('清除数据',rep)
					// uni.clearStorage();
					await uni.reLaunch({
						url:'/pages/index/index'
					})
				    uni.removeStorageSync('hotelData');
					uni.removeStorageSync('openid');
					await uni.showToast({
						title:"退出成功",
						icon:"none",
					})
				} catch (e) {
				   uni.showToast({
				   	title: e.errMsg,
				   	icon:"none"
				   })
				}
			}
		}
	}
</script>

<style lang="scss">
.setting {
	.set-but {
		background-color: #FFFFFF;
		margin: 20rpx;
		margin-bottom: 80rpx;
		border-radius: 20rpx;
		overflow: hidden;
		padding: 20rpx 0;
		.but {
			display: flex;
			justify-content: space-between;
			align-items: center;
			border: 0;
			font-weight: 500;
			color: #000000;
			font-size: 28rpx;
		}
	}
	.bom-but {
		width: 100%;
		height: 80rpx;
		.but {
			color: #FFFFFF;
			background: linear-gradient(-90deg, #8dc9f1, #d8eefc);
			border-radius: 40rpx;
			line-height: 80rpx;
			border: 0;
			margin: 0 20rpx;
		}
	}
}
</style>
